#ifndef DESTRUCTIONSTRATEGY_H
#define DESTRUCTIONSTRATEGY_H

#pragma once

#include "../../ToolkitLayer.h"
#include "AnimationStrategy.h"

class LargeDisplayEvent;


/**
 * This strategy provides a base class for different types of destruction
 * strategies, which is a specific type of AnimationStrategy. A destruction
 * strategy is usually used when a component is dropped into a container/widget
 * which has a DestroyerStrategy. It defines how the associated component
 * should behave when being deleted. A strategy that extends this one should
 * provide an implementation of the animate() method, which consists of an
 * animation to be run before the destruction of the associated component. The
 * animation is triggered when this strategy receives a "START_ANIMATION"
 * event. It replies this event with another event of the type "READY_TO_DIE",
 * when the animation is completed and the component can be finally deleted.
 *
 * @author Fabricio Anastacio - fabriciocfa@yahoo.com
 * @since December 1, 2007
 */
class TOOLKITLAYER_API DestructionStrategy : public AnimationStrategy
{
	// Attributes
protected:
	/** The component with a DestroyerStrategy that triggered this destruction. */
	VisComponent* destroyer;


	// Methods
public:
	/**
	 * Creates a DestructionStrategy instance.
	 */
	DestructionStrategy(void);
	/**
	 * Destroys this strategy.
	 */
	~DestructionStrategy(void);


protected:
	/**
	 * Animates the destruction of the associated component. It is run inside
	 * the process() method.
	 */
	virtual void animate() = 0;

	/**
	 * Performs a specific action when the animation is over.
	 */
	virtual void onAnimationEnd();
	/**
	 * Performs a specific action when the animation starts.
	 *
	 * @param evt the event that triggered the animation.
	 */
	virtual void onAnimationStart(LargeDisplayEvent *evt);
};

#endif  // DESTRUCTIONSTRATEGY_H
